import request from "@/request/index.js";

export function adminOrder(data){
    return request({
        url:"/adminApi/admin/adminOrder",
        method:"post",
        data
    })
}

export function adminDeliveryAdd(data){
    return request({
        url:"/adminApi/admin/adminDeliveryAdd",
        method:"post",
        data
    })
}

export function adminAdd(data){
    return request({
        url:"/adminApi/admin/adminAdd",
        method:"post",
        data
    })
}

export function adminFindPage(data){
    return request({
        url:"/adminApi/admin/FindPage",
        method:"post",
        data
    })
}

export function adminDeliverySouSu(data){
    return request({
        url:'/adminApi/admin/adminDeliverySouSu',
        method:"post",
        data
    })
}

// 更新用户状态
export function adminUpdateUserStatus(userId){
    return request({
        url:"/adminApi/admin/toggleUserStatus",
        method:"post",
        params: {
            userId: userId
        }
    })
}

// 上传头像
export function uploadAvatar(file) {
    const formData = new FormData()
    formData.append('file', file)
    return request({
        url: '/adminApi/admin/uploadAvatar',
        method: 'post',
        data: formData,
        headers: { 'Content-Type': 'multipart/form-data' }
    })
}
